package com.dgut.controller;


import com.dgut.domain.Log;
import com.dgut.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/log")
public class LogController {

    @Autowired
    private ILogService logService;


    @RequestMapping("/list")
    public ModelAndView list(){
        //获取到所有的日志列表
        List<Log> logs = logService.findLogs();
        //构建返回
        ModelAndView mv = new ModelAndView();
        //返回列表数据给页面
        mv.addObject("logList",logs);
        //显示的页面
        mv.setViewName("log/list");
        return mv;
    }

}
